<extend name='Public/demo' />
<block name="contents">
    <div class="row">
        <div class="col-lg-12">
            <section class="panel">
                <header class="panel-heading">
                    网站设置
                </header>
                <div class="panel-body">
                    <form class="form-horizontal tasi-form">
                        <div class="form-group">
                            <label class="col-sm-2 ">网站名称</label>
                            <div class="col-sm-10">
                                <input type="text" name="sitename" class="form-control" value="{$sitename}">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 ">网站域名</label>
                            <div class="col-sm-10">
                                <input type="text" name="websiteurl" class="form-control" value="{$websiteurl}">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 ">网站简介</label>
                            <div class="col-sm-10">
                               <textarea class="form-control" name="siteinfo" rows="3" >{$siteinfo}</textarea>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 ">网站关键词</label>
                            <div class="col-sm-10">
                                <input name="keywords" id="tagsinput" class="tagsinput" value="{$keywords}" />
                            </div>
                        </div>
                        <button type="button" class="btn btn-default setvalue">提交修改</button>
                    </form>
                </div>
            </section>
        </div>
    </div>
    <!-- ico图片设置 S -->
    <div class="row">
        <div class="col-lg-12">
            <section class="panel">
                <header class="panel-heading">
                    网站图标设置
                </header>
                <div class="panel-body">
                    <form class="form-horizontal tasi-form" action="{:U('Seo/icoimg')}" method="post" enctype="multipart/form-data">
                    <?php echo !empty($icoimg)? '<img style="float:left;margin-right:20px;width:50px" src="__PUBLIC__'.$icoimg.'">' : '' ; ?>
                    <div class="form-group" style="float:left">
                          <label for="exampleInputFile">网站图标上传</label>
                          <input type="file" id="exampleInputFile" name="icoimg">
                          <p class="help-block">请上传png/ico图片</p>
                      </div>
                      <div style="clear:both"></div>
                        <button class="btn btn-default setico">提交修改</button>
                    </form>
                </div>
            </section>
        </div>
    </div>
    <!-- ico图片设置 E -->
    <script src="__PUBLIC__/Theme/js/jquery.tagsinput.js"></script>
    <script src="__PUBLIC__/Theme/js/form-component.js"></script>
    <script type="text/javascript">
        var arr = new Array();
        $('.setvalue').click(function(){
            //修改按钮状态
            var th = $(this);
            th.html('正在保存~');
            //得到网站的名称
            arr['sitename'] = $('input[name=sitename]').val();
            //得到网站的网址
            arr['websiteurl'] = $('input[name=websiteurl]').val();
            //得到网站的简介
            arr['siteinfo'] = $('textarea[name=siteinfo]').val();
            //得到网站的关键词
            arr['keywords'] = $('input[name=keywords]').val();

            //发送ajax 保存数据到数据库
            $.post("{:U('Seo/ajaxseo')}",{'sitename':arr['sitename'],'websiteurl':arr['websiteurl'],'siteinfo':arr['siteinfo'],'keywords':arr['keywords']},function(data){
                th.html('保存成功!');
                setTimeout(function(){
                    th.html('提交修改');
                },500)
            });

            return false;
        });
    </script>
</block>
